<template>
  <mars-dialog
    customClass="base-pannel"
    width="330"
    bottom="10"
    left="150"
    height="10%"
  >
    <div class="legend-container">
      <div class="legend-items">
        <!-- 区域（推广）站图例 -->
        <div class="legend-item">
          <div class="legend-icon">
            <img src="https://data.mars3d.cn/img/marker/mark-blue.png" alt="区域站图标" class="icon-image" />
          </div>
          <div class="legend-text">
            <h3>区域（推广）站</h3>
            <p>代表县级农业推广区域站，负责统筹多个乡镇的农业技术推广工作</p>
          </div>
        </div>

        <!-- 乡镇（推广）站图例 -->
        <div class="legend-item">
          <div class="legend-icon">
            <img src="https://data.mars3d.cn/img/marker/lace-red.png" alt="乡镇站图标" class="icon-image" />
          </div>
          <div class="legend-text">
            <h3>乡镇（推广）站</h3>
            <p>代表乡镇级农业推广站，负责本乡镇范围内的农业技术推广与服务</p>
          </div>
        </div>
        <!-- 合作社图标站图例 -->
        <div class="legend-item">
          <div class="legend-icon">
            <img src="https://data.mars3d.cn/img/marker/mark-red.png" alt="合作社图标" class="icon-image" />
          </div>
          <div class="legend-text">
            <h3>合作社图标</h3>
            <p>代表乡镇级农业推广站，负责本乡镇范围内的农业技术推广与服务</p>
          </div>
        </div>
      </div>
    </div>
  </mars-dialog>
</template>

<script setup lang="ts">
import { ref, onMounted } from "vue"
import { useWidget } from "@mars/common/store/widget"
import * as mapWork from "../header/map"
import useLifecycle from "@mars/common/uses/use-lifecycle"

const { activate } = useWidget()
useLifecycle(mapWork)

onMounted(() => {})
</script>

<style lang="less">
// 基础样式重置
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Microsoft YaHei", sans-serif;
}

// 透明对话框样式
.mars-dialog {
  .mars-dialog__content {
    background-color: transparent;
    padding: 0;
  }
}

.transparent-dialog {
  .mars-dialog__header {
    background-color: transparent;
    border-bottom: none;
  }
  .mars-dialog__footer {
    background-color: transparent;
    border-top: none;
  }
}

// 图例容器样式
.legend-container {
  width: 100%;
  height: 100%;
  padding: 10px;
  display: flex;
  flex-direction: column;
}

// 图例标题样式
.legend-title {
  text-align: center;
  padding: 15px 0;
  color: #fff;
  background-color: rgba(0, 0, 0, 0.4);
  border-radius: 12px 12px 0 0;
  margin-bottom: 15px;
}

// 图例项目样式
.legend-items {
  flex: 1;
  background-color: rgba(0, 0, 0, 0.4);
  border-radius: 0 0 12px 12px;
  padding: 20px;
  overflow-y: auto;
}

.legend-item {
  display: flex;
  align-items: flex-start;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);

  &:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
  }
}

// 图例图标样式
.legend-icon {
  flex: 0 0 60px;
  width: 60px;
  height: 60px;
  border-radius: 8px;
  overflow: hidden;
  margin-right: 15px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.icon-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

// 图例文本样式
.legend-text {
  flex: 1;
  color: #fff;
}

.legend-text h3 {
  font-size: 16px;
  margin-bottom: 5px;
  color: #e6e6e6;
}

.legend-text p {
  font-size: 13px;
  line-height: 1.5;
  color: #cccccc;
}

// 对话框头部样式
.mars-dialog .mars-dialog__header {
  background-image: url("/img/panel-header1.png");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  height: 50px;

  .mars-dialog__title {
    color: #fff;
    margin-left: 15px;
    line-height: 50px;
  }

  .mars-dialog__close {
    color: #fff;
    line-height: 50px;
  }
}
</style>
